/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmMain.java
 *
 * Created on 21 Sep 12, 22:38:15
 */
package sistemperpustakaan.view;

import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.Timer;
import javax.swing.UIManager;
import sistemperpustakaan.actionlistener.MenuLookAndFeelActionListener;
import sistemperpustakaan.actionlistener.ViewAnggotaActionListener;
import sistemperpustakaan.actionlistener.ViewBukuActionListener;
import sistemperpustakaan.actionlistener.ViewInventarisActionListener;
import sistemperpustakaan.actionlistener.ViewJenisBukuActionListener;
import sistemperpustakaan.actionlistener.ViewKategoriBukuActionListener;
import sistemperpustakaan.actionlistener.ViewTransaksiActionListener;
import sistemperpustakaan.actionlistener.ViewPenerbitBukuActionListener;
import sistemperpustakaan.actionlistener.ViewSettingDendaActionListener;
import sistemperpustakaan.actionlistener.ViewSettingHariLiburActionListener;
import sistemperpustakaan.actionlistener.ViewTipeUserActionListener;
import sistemperpustakaan.actionlistener.ViewUbahPasswordActionListener;
import sistemperpustakaan.actionlistener.ViewUserActionListener;
import sistemperpustakaan.component.MyButton;
import sistemperpustakaan.controller.UserController;
import sistemperpustakaan.utility.UserUtility;
import sistemperpustakaan.view.anggota.FrmAnggotaView;
import sistemperpustakaan.view.buku.FrmBukuView;
import sistemperpustakaan.view.buku.FrmJenisBukuView;
import sistemperpustakaan.view.buku.FrmInventaris;
import sistemperpustakaan.view.buku.FrmKategoriBukuView;
import sistemperpustakaan.view.buku.FrmPenerbitBukuView;
import sistemperpustakaan.view.denda.FrmDendaBuku;
import sistemperpustakaan.view.harilibur.FrmHariLiburView;
import sistemperpustakaan.view.transaksi.FrmTransaksiView;
import sistemperpustakaan.view.user.FrmTipeUserView;
import sistemperpustakaan.view.user.FrmUbahPassword;
import sistemperpustakaan.view.user.FrmUserView;

/**
 *
 * @author EKo
 */
public class FrmMain extends javax.swing.JFrame {

    String idUser = UserUtility.idUser;
    UserController userController;

    /**
     * Creates new form FrmMain
     */
    public FrmMain() {
        initComponents();
        setSize(800, 600);
//        ImageIcon icon = new ImageIcon(getClass().getResource("../image/ico.png"));
//        this.setIconImage(icon.getImage());
        setExtendedState(MAXIMIZED_BOTH);
        setTanggal();
        setButton();
        setPrivilege();
        labelUserName.setText("    SISTEM INFORMASI PERPUSTAKAAN Version 1.0.0   Selamat Datang : " + UserUtility.name);
        initializeLookAndFeel();
        radioNimbuz.setSelected(true);

    }

    public static void initializeLookAndFeel() {
        try {
            UIManager.setLookAndFeel(new NimbusLookAndFeel());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    public JDesktopPane getDesktopPane() {
        return desktop;
    }

    public FrmBukuView getBukuView() {
        return bukuView;
    }

    public FrmInventaris getInventarisView() {
        return inventarisView;
    }

    public void setInventarisView(FrmInventaris inventarisView) {
        this.inventarisView = inventarisView;
    }

    public void setBukuView(FrmBukuView bukuView) {
        this.bukuView = bukuView;
    }

    public FrmJenisBukuView getJenisBukuView() {
        return jenisBukuView;
    }

    public void setJenisBukuView(FrmJenisBukuView jenisBukuView) {
        this.jenisBukuView = jenisBukuView;
    }

    public FrmKategoriBukuView getKategoriBukuView() {
        return kategoriBukuView;
    }

    public void setKategoriBukuView(FrmKategoriBukuView kategoriBukuView) {
        this.kategoriBukuView = kategoriBukuView;
    }

    public FrmPenerbitBukuView getPenerbitBukuView() {
        return penerbitBukuView;
    }

    public void setPenerbitBukuView(FrmPenerbitBukuView penerbitBukuView) {
        this.penerbitBukuView = penerbitBukuView;
    }

    public FrmTransaksiView getPeminjamanView() {
        return peminjamanView;
    }

    public void setPeminjamanView(FrmTransaksiView peminjamanView) {
        this.peminjamanView = peminjamanView;
    }

    public FrmAnggotaView getAnggotaView() {
        return anggotaView;
    }

    public void setAnggotaView(FrmAnggotaView anggotaView) {
        this.anggotaView = anggotaView;
    }

    public FrmTipeUserView getTipeUserView() {
        return tipeUserView;
    }

    public void setTipeUserView(FrmTipeUserView tipeUserView) {
        this.tipeUserView = tipeUserView;
    }

    public FrmUserView getUserView() {
        return userView;
    }

    public void setUserView(FrmUserView userView) {
        this.userView = userView;
    }

    public JRadioButton getRadioMetal() {
        return radioMetal;
    }

    public void setRadioMetal(JRadioButton radioMetal) {
        this.radioMetal = radioMetal;
    }

    public JRadioButton getRadioMotif() {
        return radioMotif;
    }

    public void setRadioMotif(JRadioButton radioMotif) {
        this.radioMotif = radioMotif;
    }

    public JRadioButton getRadioNimbuz() {
        return radioNimbuz;
    }

    public void setRadioNimbuz(JRadioButton radioNimbuz) {
        this.radioNimbuz = radioNimbuz;
    }

    public JRadioButton getRadioWindow() {
        return radioWindow;
    }

    public void setRadioWindow(JRadioButton radioWindow) {
        this.radioWindow = radioWindow;
    }

    public MyButton getBtnCari() {
        return btnCari;
    }

    public MyButton getBtnDetail() {
        return btnDetail;
    }

    public void setBtnDetail(MyButton btnDetail) {
        this.btnDetail = btnDetail;
    }

    public MyButton getBtnEdit() {
        return btnEdit;
    }

    public void setBtnEdit(MyButton btnEdit) {
        this.btnEdit = btnEdit;
    }

    public MyButton getBtnHapus() {
        return btnHapus;
    }

    public void setBtnHapus(MyButton btnHapus) {
        this.btnHapus = btnHapus;
    }

    public MyButton getBtnTambah() {
        return btnTambah;
    }

    public void setBtnTambah(MyButton btnTambah) {
        this.btnTambah = btnTambah;
    }

    public MyButton getBtnViewReport() {
        return btnViewReport;
    }

    public void setBtnViewReport(MyButton btnViewReport) {
        this.btnViewReport = btnViewReport;
    }

    public MyButton getBtnPrintReport() {
        return btnPrintReport;
    }

    public void setBtnPrintReport(MyButton btnPrintReport) {
        this.btnPrintReport = btnPrintReport;
    }

    public MyButton getBtnRefresh() {
        return btnRefresh;
    }

    public void setBtnRefresh(MyButton btnRefresh) {
        this.btnRefresh = btnRefresh;
    }

    public FrmDendaBuku getDendaBuku() {
        return dendaBuku;
    }

    public void setDendaBuku(FrmDendaBuku dendaBuku) {
        this.dendaBuku = dendaBuku;
    }

    public FrmUbahPassword getUbahPassword() {
        return ubahPassword;
    }

    public void setUbahPassword(FrmUbahPassword ubahPassword) {
        this.ubahPassword = ubahPassword;
    }

    public FrmHariLiburView getHariLiburView() {
        return hariLiburView;
    }

    public void setHariLiburView(FrmHariLiburView hariLiburView) {
        this.hariLiburView = hariLiburView;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lookandfeel = new javax.swing.ButtonGroup();
        menu = new javax.swing.JPanel();
        menubar = new javax.swing.JTabbedPane();
        home = new javax.swing.JPanel();
        btnCari = new sistemperpustakaan.component.MyButton();
        btnDetail = new sistemperpustakaan.component.MyButton();
        btnRefresh = new sistemperpustakaan.component.MyButton();
        btnTambah = new sistemperpustakaan.component.MyButton();
        btnEdit = new sistemperpustakaan.component.MyButton();
        btnHapus = new sistemperpustakaan.component.MyButton();
        btnTransaksi = new sistemperpustakaan.component.MyButton();
        buku = new javax.swing.JPanel();
        btnListBuku = new sistemperpustakaan.component.MyButton();
        btnJenisBuku = new sistemperpustakaan.component.MyButton();
        btnKategoriBuku = new sistemperpustakaan.component.MyButton();
        btnPenerbitBuku = new sistemperpustakaan.component.MyButton();
        bg_buku = new javax.swing.JLabel();
        btnLogout = new sistemperpustakaan.component.MyButton();
        btnInventaris = new sistemperpustakaan.component.MyButton();
        member = new javax.swing.JPanel();
        btnListAnggota = new sistemperpustakaan.component.MyButton();
        user = new javax.swing.JPanel();
        btnListUser = new sistemperpustakaan.component.MyButton();
        btnTipeUser = new sistemperpustakaan.component.MyButton();
        bg_user = new javax.swing.JLabel();
        btnUbahPassword = new sistemperpustakaan.component.MyButton();
        tools = new javax.swing.JPanel();
        btnKalkulator = new sistemperpustakaan.component.MyButton();
        btnNotepad = new sistemperpustakaan.component.MyButton();
        looknfeel = new javax.swing.JPanel();
        radioNimbuz = new javax.swing.JRadioButton();
        radioWindow = new javax.swing.JRadioButton();
        radioMetal = new javax.swing.JRadioButton();
        radioMotif = new javax.swing.JRadioButton();
        bg_looknfeel = new javax.swing.JLabel();
        btnSettingDenda = new sistemperpustakaan.component.MyButton();
        btnSettingHariLibur = new sistemperpustakaan.component.MyButton();
        report = new javax.swing.JPanel();
        btnViewReport = new sistemperpustakaan.component.MyButton();
        btnPrintReport = new sistemperpustakaan.component.MyButton();
        window = new javax.swing.JPanel();
        btnHelp = new sistemperpustakaan.component.MyButton();
        btnAbout = new sistemperpustakaan.component.MyButton();
        btnExit = new sistemperpustakaan.component.MyButton();
        isi = new javax.swing.JPanel();
        desktop = new sistemperpustakaan.component.MyDesktop();
        tanggal = new javax.swing.JPanel();
        labelUserName = new javax.swing.JLabel();
        labelDate = new javax.swing.JLabel();
        labelClock = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Sistem Informasi Perpustakaan v 1.0.0");

        menubar.setAlignmentX(0.0F);
        menubar.setAlignmentY(0.0F);
        menubar.setPreferredSize(new java.awt.Dimension(703, 123));

        home.setPreferredSize(new java.awt.Dimension(708, 95));
        home.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnCari.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_search.png"))); // NOI18N
        btnCari.setAlignmentY(0.0F);
        btnCari.setPreferredSize(new java.awt.Dimension(80, 80));
        btnCari.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_search_over.png"))); // NOI18N
        home.add(btnCari, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        btnDetail.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_detail.png"))); // NOI18N
        btnDetail.setAlignmentY(0.0F);
        btnDetail.setPreferredSize(new java.awt.Dimension(80, 80));
        btnDetail.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_detail_over.png"))); // NOI18N
        home.add(btnDetail, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, -1, -1));

        btnRefresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_refresh.png"))); // NOI18N
        btnRefresh.setAlignmentY(0.0F);
        btnRefresh.setPreferredSize(new java.awt.Dimension(80, 80));
        btnRefresh.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_refresh_over.png"))); // NOI18N
        home.add(btnRefresh, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 0, -1, -1));

        btnTambah.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_tambah.png"))); // NOI18N
        btnTambah.setAlignmentY(0.0F);
        btnTambah.setPreferredSize(new java.awt.Dimension(80, 80));
        btnTambah.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_tambah_over.png"))); // NOI18N
        home.add(btnTambah, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 0, -1, -1));

        btnEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_edit.png"))); // NOI18N
        btnEdit.setAlignmentY(0.0F);
        btnEdit.setPreferredSize(new java.awt.Dimension(80, 80));
        btnEdit.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_edit_over.png"))); // NOI18N
        home.add(btnEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 0, -1, -1));

        btnHapus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_delete.png"))); // NOI18N
        btnHapus.setAlignmentY(0.0F);
        btnHapus.setPreferredSize(new java.awt.Dimension(80, 80));
        btnHapus.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_delete_over.png"))); // NOI18N
        home.add(btnHapus, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 0, -1, -1));

        btnTransaksi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_transaksi.png"))); // NOI18N
        btnTransaksi.setAlignmentY(0.0F);
        btnTransaksi.setPreferredSize(new java.awt.Dimension(80, 80));
        btnTransaksi.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_transaksi_over.png"))); // NOI18N
        home.add(btnTransaksi, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 0, -1, -1));

        buku.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnListBuku.setBorder(null);
        btnListBuku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listBuku.png"))); // NOI18N
        btnListBuku.setBorderPainted(false);
        btnListBuku.setContentAreaFilled(false);
        btnListBuku.setPreferredSize(new java.awt.Dimension(50, 80));
        btnListBuku.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listBuku_press.png"))); // NOI18N
        btnListBuku.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listBuku_over.png"))); // NOI18N
        buku.add(btnListBuku, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 50, 80));

        btnJenisBuku.setBorder(null);
        btnJenisBuku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_jenisBuku.png"))); // NOI18N
        btnJenisBuku.setBorderPainted(false);
        btnJenisBuku.setContentAreaFilled(false);
        btnJenisBuku.setPreferredSize(new java.awt.Dimension(50, 80));
        btnJenisBuku.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_jenisBuku_press.png"))); // NOI18N
        btnJenisBuku.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_jenisBuku_over.png"))); // NOI18N
        buku.add(btnJenisBuku, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 0, -1, -1));

        btnKategoriBuku.setBorder(null);
        btnKategoriBuku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_kategoriBuku.png"))); // NOI18N
        btnKategoriBuku.setBorderPainted(false);
        btnKategoriBuku.setContentAreaFilled(false);
        btnKategoriBuku.setPreferredSize(new java.awt.Dimension(50, 80));
        btnKategoriBuku.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_kategoriBuku_press.png"))); // NOI18N
        btnKategoriBuku.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_kategoriBuku_over.png"))); // NOI18N
        buku.add(btnKategoriBuku, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 0, -1, -1));

        btnPenerbitBuku.setBorder(null);
        btnPenerbitBuku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_penerbit.png"))); // NOI18N
        btnPenerbitBuku.setBorderPainted(false);
        btnPenerbitBuku.setContentAreaFilled(false);
        btnPenerbitBuku.setPreferredSize(new java.awt.Dimension(50, 80));
        btnPenerbitBuku.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_penerbit_press.png"))); // NOI18N
        btnPenerbitBuku.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_penerbit_over.png"))); // NOI18N
        buku.add(btnPenerbitBuku, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 0, -1, -1));

        bg_buku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/bg_button_buku.png"))); // NOI18N
        bg_buku.setAlignmentY(0.0F);
        buku.add(bg_buku, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        home.add(buku, new org.netbeans.lib.awtextra.AbsoluteConstraints(603, 0, 200, 80));

        btnLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_logout.png"))); // NOI18N
        btnLogout.setMaximumSize(new java.awt.Dimension(103, 90));
        btnLogout.setPreferredSize(new java.awt.Dimension(80, 80));
        btnLogout.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_logout_over.png"))); // NOI18N
        home.add(btnLogout, new org.netbeans.lib.awtextra.AbsoluteConstraints(895, 0, -1, -1));

        btnInventaris.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_inventaris.png"))); // NOI18N
        btnInventaris.setAlignmentY(0.0F);
        btnInventaris.setMaximumSize(new java.awt.Dimension(80, 80));
        btnInventaris.setPreferredSize(new java.awt.Dimension(80, 80));
        btnInventaris.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_inventaris_over.png"))); // NOI18N
        home.add(btnInventaris, new org.netbeans.lib.awtextra.AbsoluteConstraints(805, 0, 80, -1));

        menubar.addTab("          HOME          ", home);

        member.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnListAnggota.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_anggota.png"))); // NOI18N
        btnListAnggota.setAlignmentY(0.0F);
        btnListAnggota.setPreferredSize(new java.awt.Dimension(50, 80));
        btnListAnggota.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_anggota.png"))); // NOI18N
        btnListAnggota.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_anggota_over.png"))); // NOI18N
        member.add(btnListAnggota, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 80, 80));

        user.setAlignmentX(10.0F);
        user.setAlignmentY(0.0F);
        user.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnListUser.setBorder(null);
        btnListUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listUser.png"))); // NOI18N
        btnListUser.setBorderPainted(false);
        btnListUser.setContentAreaFilled(false);
        btnListUser.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listUser_press.png"))); // NOI18N
        btnListUser.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_listUser_over.png"))); // NOI18N
        user.add(btnListUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 50, 80));

        btnTipeUser.setBorder(null);
        btnTipeUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_tipeUser.png"))); // NOI18N
        btnTipeUser.setBorderPainted(false);
        btnTipeUser.setContentAreaFilled(false);
        btnTipeUser.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_tipeUser_press.png"))); // NOI18N
        btnTipeUser.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_tipeUser_over.png"))); // NOI18N
        user.add(btnTipeUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 0, 50, 80));

        bg_user.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/bg_button_user.png"))); // NOI18N
        bg_user.setAlignmentY(0.0F);
        user.add(bg_user, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        member.add(user, new org.netbeans.lib.awtextra.AbsoluteConstraints(85, 0, 100, 80));

        btnUbahPassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_ubahPassword.png"))); // NOI18N
        btnUbahPassword.setMaximumSize(new java.awt.Dimension(85, 80));
        btnUbahPassword.setPreferredSize(new java.awt.Dimension(80, 80));
        btnUbahPassword.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_ubahPassword.png"))); // NOI18N
        btnUbahPassword.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_ubahPassword_over.png"))); // NOI18N
        member.add(btnUbahPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 0, -1, -1));

        menubar.addTab("  ANGGOTA & PENGGUNA  ", member);

        tools.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnKalkulator.setBorder(null);
        btnKalkulator.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_calculator.png"))); // NOI18N
        btnKalkulator.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_calculator_over.png"))); // NOI18N
        tools.add(btnKalkulator, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 80, 80));

        btnNotepad.setBorder(null);
        btnNotepad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_notepad.png"))); // NOI18N
        btnNotepad.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_notepad_over.png"))); // NOI18N
        tools.add(btnNotepad, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 80, 80));

        looknfeel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lookandfeel.add(radioNimbuz);
        radioNimbuz.setText("Nimbuz");
        looknfeel.add(radioNimbuz, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        lookandfeel.add(radioWindow);
        radioWindow.setText("Windows");
        looknfeel.add(radioWindow, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        lookandfeel.add(radioMetal);
        radioMetal.setText("Metal");
        looknfeel.add(radioMetal, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, -1, -1));

        lookandfeel.add(radioMotif);
        radioMotif.setText("Motif");
        looknfeel.add(radioMotif, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, -1, -1));

        bg_looknfeel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/bg_lookandfeel.png"))); // NOI18N
        looknfeel.add(bg_looknfeel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 80));

        tools.add(looknfeel, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 0, 200, 80));

        btnSettingDenda.setBorder(null);
        btnSettingDenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settingdenda.png"))); // NOI18N
        btnSettingDenda.setMinimumSize(new java.awt.Dimension(80, 80));
        btnSettingDenda.setPreferredSize(new java.awt.Dimension(80, 80));
        btnSettingDenda.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settingdenda.png"))); // NOI18N
        btnSettingDenda.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settingdenda_over.png"))); // NOI18N
        tools.add(btnSettingDenda, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 0, -1, -1));

        btnSettingHariLibur.setBorder(null);
        btnSettingHariLibur.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settinglibur.png"))); // NOI18N
        btnSettingHariLibur.setMinimumSize(new java.awt.Dimension(80, 80));
        btnSettingHariLibur.setPreferredSize(new java.awt.Dimension(80, 80));
        btnSettingHariLibur.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settinglibur.png"))); // NOI18N
        btnSettingHariLibur.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_settinglibur_over.png"))); // NOI18N
        tools.add(btnSettingHariLibur, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 0, -1, -1));

        menubar.addTab("   ALAT & PENGATURAN   ", tools);

        report.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnViewReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_viewReport.png"))); // NOI18N
        btnViewReport.setAlignmentY(0.0F);
        btnViewReport.setMinimumSize(new java.awt.Dimension(103, 780));
        btnViewReport.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_viewReport_over.png"))); // NOI18N
        report.add(btnViewReport, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 80, 80));

        btnPrintReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_printReport.png"))); // NOI18N
        btnPrintReport.setAlignmentY(0.0F);
        btnPrintReport.setMinimumSize(new java.awt.Dimension(103, 780));
        btnPrintReport.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_printReport_over.png"))); // NOI18N
        report.add(btnPrintReport, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 80, 80));

        menubar.addTab("     LAPORAN     ", report);

        window.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_help.png"))); // NOI18N
        btnHelp.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_help_over.png"))); // NOI18N
        window.add(btnHelp, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 80, 80));

        btnAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_about.png"))); // NOI18N
        btnAbout.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_about_over.png"))); // NOI18N
        window.add(btnAbout, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 80, 80));

        btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_exit.png"))); // NOI18N
        btnExit.setMaximumSize(new java.awt.Dimension(103, 90));
        btnExit.setPreferredSize(new java.awt.Dimension(80, 80));
        btnExit.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/btn_exit_over.png"))); // NOI18N
        window.add(btnExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 0, -1, -1));

        menubar.addTab("     WINDOW     ", window);

        javax.swing.GroupLayout menuLayout = new javax.swing.GroupLayout(menu);
        menu.setLayout(menuLayout);
        menuLayout.setHorizontalGroup(
            menuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(menubar, javax.swing.GroupLayout.DEFAULT_SIZE, 1003, Short.MAX_VALUE)
        );
        menuLayout.setVerticalGroup(
            menuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(menubar, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        isi.setAlignmentX(0.0F);
        isi.setAlignmentY(0.0F);

        javax.swing.GroupLayout isiLayout = new javax.swing.GroupLayout(isi);
        isi.setLayout(isiLayout);
        isiLayout.setHorizontalGroup(
            isiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktop, javax.swing.GroupLayout.DEFAULT_SIZE, 1003, Short.MAX_VALUE)
        );
        isiLayout.setVerticalGroup(
            isiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktop, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
        );

        tanggal.setAlignmentX(0.0F);
        tanggal.setAlignmentY(0.0F);
        tanggal.setPreferredSize(new java.awt.Dimension(703, 15));

        labelUserName.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        labelUserName.setText("SYSTEM INFORMASI PERPUSTAKAAN Version 1.0.0");

        labelDate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        labelDate.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        labelDate.setText("12 Juni 2012");

        labelClock.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        labelClock.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        labelClock.setText("00:00:00");

        javax.swing.GroupLayout tanggalLayout = new javax.swing.GroupLayout(tanggal);
        tanggal.setLayout(tanggalLayout);
        tanggalLayout.setHorizontalGroup(
            tanggalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tanggalLayout.createSequentialGroup()
                .addComponent(labelUserName)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 198, Short.MAX_VALUE)
                .addComponent(labelDate, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelClock, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        tanggalLayout.setVerticalGroup(
            tanggalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tanggalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(labelUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE)
                .addComponent(labelClock)
                .addComponent(labelDate, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(menu, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(isi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(tanggal, javax.swing.GroupLayout.DEFAULT_SIZE, 1003, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(menu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(isi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(1, 1, 1)
                .addComponent(tanggal, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    private void setTanggal() {
        SimpleDateFormat df = new SimpleDateFormat("EEEE, dd MMMM yyyy");
        Date date = new Date();
        labelDate.setText(df.format(date) + "   ");
        labelUserName.setText(" SYSTEM INFORMASI PERPUSTAKAAN Version 1.0.0");


        ActionListener listener = new ActionListener() {
            public void actionPerformed(ActionEvent act) {
                String sJam = " ";
                String sMenit = " ";
                String sDetik = " ";

                Date today = new Date();
                int now_Jam = today.getHours(); //Mengambil jam saat ini
                int now_Menit = today.getMinutes(); // Mengambil menit saat ini
                int now_Detik = today.getSeconds(); //Mengambil detik saat ini

                if (now_Jam <= 9) {
                    sJam = "0"; //Menambah angka 0 di depan Jam
                }
                if (now_Menit <= 9) {
                    sMenit = "0";  //Menambah angka 0 di depan Menit
                }
                if (now_Detik <= 9) {
                    sDetik = "0"; //Menambah angka 0 di depan Detik
                }

                String Jam = sJam + Integer.toString(now_Jam);  //Merubah type data int    now_Jam menjadi String
                String Menit = sMenit + Integer.toString(now_Menit); //Merubah type data int now_Menit menjadi String
                String Detik = sDetik + Integer.toString(now_Detik); //Merubah type data int now_Detik menjadi String

                labelClock.setText(Jam + " : " + Menit + " : " + Detik);

            }
        };

        Timer waktu = new Timer(1000, listener);
        waktu.start();
    }

    public void dispose() {
        if (JOptionPane.showConfirmDialog(this, "Apakah anda yakin akan keluar?", "Keluar Aplikasi",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel bg_buku;
    private javax.swing.JLabel bg_looknfeel;
    private javax.swing.JLabel bg_user;
    private sistemperpustakaan.component.MyButton btnAbout;
    private sistemperpustakaan.component.MyButton btnCari;
    private sistemperpustakaan.component.MyButton btnDetail;
    private sistemperpustakaan.component.MyButton btnEdit;
    private sistemperpustakaan.component.MyButton btnExit;
    private sistemperpustakaan.component.MyButton btnHapus;
    private sistemperpustakaan.component.MyButton btnHelp;
    private sistemperpustakaan.component.MyButton btnInventaris;
    private sistemperpustakaan.component.MyButton btnJenisBuku;
    private sistemperpustakaan.component.MyButton btnKalkulator;
    private sistemperpustakaan.component.MyButton btnKategoriBuku;
    private sistemperpustakaan.component.MyButton btnListAnggota;
    private sistemperpustakaan.component.MyButton btnListBuku;
    private sistemperpustakaan.component.MyButton btnListUser;
    private sistemperpustakaan.component.MyButton btnLogout;
    private sistemperpustakaan.component.MyButton btnNotepad;
    private sistemperpustakaan.component.MyButton btnPenerbitBuku;
    private sistemperpustakaan.component.MyButton btnPrintReport;
    private sistemperpustakaan.component.MyButton btnRefresh;
    private sistemperpustakaan.component.MyButton btnSettingDenda;
    private sistemperpustakaan.component.MyButton btnSettingHariLibur;
    private sistemperpustakaan.component.MyButton btnTambah;
    private sistemperpustakaan.component.MyButton btnTipeUser;
    private sistemperpustakaan.component.MyButton btnTransaksi;
    private sistemperpustakaan.component.MyButton btnUbahPassword;
    private sistemperpustakaan.component.MyButton btnViewReport;
    private javax.swing.JPanel buku;
    private sistemperpustakaan.component.MyDesktop desktop;
    private javax.swing.JPanel home;
    private javax.swing.JPanel isi;
    private javax.swing.JLabel labelClock;
    private javax.swing.JLabel labelDate;
    private javax.swing.JLabel labelUserName;
    private javax.swing.ButtonGroup lookandfeel;
    private javax.swing.JPanel looknfeel;
    private javax.swing.JPanel member;
    private javax.swing.JPanel menu;
    private javax.swing.JTabbedPane menubar;
    private javax.swing.JRadioButton radioMetal;
    private javax.swing.JRadioButton radioMotif;
    private javax.swing.JRadioButton radioNimbuz;
    private javax.swing.JRadioButton radioWindow;
    private javax.swing.JPanel report;
    private javax.swing.JPanel tanggal;
    private javax.swing.JPanel tools;
    private javax.swing.JPanel user;
    private javax.swing.JPanel window;
    // End of variables declaration//GEN-END:variables

    private void setButton() {
        btnCari.setActionListener(null);
        btnDetail.setActionListener(null);
        btnEdit.setActionListener(btnDetail.getActionListener());


        btnInventaris.setActionListener(new ViewInventarisActionListener(this));
        btnExit.setActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
        btnListBuku.setActionListener(new ViewBukuActionListener(this));
        btnJenisBuku.setActionListener(new ViewJenisBukuActionListener(this));
        btnKategoriBuku.setActionListener(new ViewKategoriBukuActionListener(this));
        btnPenerbitBuku.setActionListener(new ViewPenerbitBukuActionListener(this));
        btnTransaksi.setActionListener(new ViewTransaksiActionListener(this));


        btnSettingDenda.setActionListener(new ViewSettingDendaActionListener(this));
        btnSettingHariLibur.setActionListener(new ViewSettingHariLiburActionListener(this));
        btnUbahPassword.setActionListener(new ViewUbahPasswordActionListener(this));

        btnLogout.setActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                logout();
            }
        });

        btnListAnggota.setActionListener(new ViewAnggotaActionListener(this));
        btnListUser.setActionListener(new ViewUserActionListener(this));
        btnTipeUser.setActionListener(new ViewTipeUserActionListener(this));

        btnNotepad.setActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    Runtime.getRuntime().exec("notepad");
                } catch (IOException ex) {
                }
            }
        });
        btnKalkulator.setActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    Runtime.getRuntime().exec("calc");
                } catch (IOException ex) {
                }
            }
        });

        radioMetal.addActionListener(new MenuLookAndFeelActionListener(this));
        radioNimbuz.addActionListener(new MenuLookAndFeelActionListener(this));
        radioWindow.addActionListener(new MenuLookAndFeelActionListener(this));
        radioMotif.addActionListener(new MenuLookAndFeelActionListener(this));

        btnAbout.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                DialogAbout about = new DialogAbout(null, true);
                about.setVisible(true);
            }
        });
        btnHelp.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FrmHelp help = new FrmHelp();
                help.setVisible(true);
            }
        });
//        btnUbahPassword.addActionListener(new ActionListener() {
//
//            public void actionPerformed(ActionEvent e) {
//                DialogUbahPassword dup = new DialogUbahPassword(null, rootPaneCheckingEnabled);
//                dup.setVisible(true);
//            }
//        });
    }

    private void logout() {
        super.dispose();
        UserUtility.initUser();
        FrmLogin fl = new FrmLogin(null, true);
        fl.setVisible(true);
    }
    FrmBukuView bukuView;
    FrmInventaris inventarisView;
    FrmJenisBukuView jenisBukuView;
    FrmKategoriBukuView kategoriBukuView;
    FrmPenerbitBukuView penerbitBukuView;
    FrmTransaksiView peminjamanView;
    FrmAnggotaView anggotaView;
    FrmUserView userView;
    FrmDendaBuku dendaBuku;
    FrmTipeUserView tipeUserView;
    FrmUbahPassword ubahPassword;
    FrmHariLiburView hariLiburView;

    private void setPrivilege() {
        btnListBuku.setEnabled(UserUtility.privilege[UserUtility.BUKU]);
        btnJenisBuku.setEnabled(UserUtility.privilege[UserUtility.JENIS_BUKU]);
        btnKategoriBuku.setEnabled(UserUtility.privilege[UserUtility.KATEGORI_BUKU]);
        btnPenerbitBuku.setEnabled(UserUtility.privilege[UserUtility.PENERBIT]);

        btnListAnggota.setEnabled(UserUtility.privilege[UserUtility.ANGGOTA]);
        btnInventaris.setEnabled(UserUtility.privilege[UserUtility.INVENTARIS]);
        btnSettingDenda.setEnabled(UserUtility.privilege[UserUtility.SETTINGDENDA]);
        btnTransaksi.setEnabled(UserUtility.privilege[UserUtility.PEMINJAMAN]);

        btnListUser.setEnabled(UserUtility.privilege[UserUtility.USER]);
        btnTipeUser.setEnabled(UserUtility.privilege[UserUtility.TYPE_USER]);

        btnTambah.setEnabled(UserUtility.privilege[UserUtility.INSERT_UPDATE_DELETE]);
        btnEdit.setEnabled(UserUtility.privilege[UserUtility.INSERT_UPDATE_DELETE]);
        btnHapus.setEnabled(UserUtility.privilege[UserUtility.INSERT_UPDATE_DELETE]);

        btnSettingHariLibur.setEnabled(UserUtility.privilege[UserUtility.SETTING_LIBUR]);
        btnUbahPassword.setEnabled(UserUtility.privilege[UserUtility.UBAH_PASSWORD]);
    }
}
